package com.mesos.test;

import com.tomcat.mesos.master.MesosScheduler;
import org.apache.mesos.MesosSchedulerDriver;
import org.apache.mesos.Protos;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Rayn on 2015/12/21 15:03
 * @email liuwei412552703@163.com
 */
public class Client
{
    private static final Logger LOG = LoggerFactory.getLogger(Client.class);

    static {
        System.setProperty("java.library.path", "D://hadoop_home//hadoop-common-2.2.0-bin-master//bin");
    }


    public static void main(String[] args)
    {
        if(args.length != 1){
            printUsage();
            System.exit(1);
        }

        LOG.info("Starting the client on Mesos with master.");


        Protos.FrameworkInfo frameworkInfo = Protos.FrameworkInfo.newBuilder().setName("测试1").setUser("hadoop").build();

        MesosSchedulerDriver mesosSchedulerDriver = new MesosSchedulerDriver(new MesosScheduler(), frameworkInfo, args[0]);


        mesosSchedulerDriver.start();

    }

    /**
     * 帮助信息
     */
    private static void printUsage(){
        System.out.println("Usage : Client <master>");
    }
}
